<template>
	<page-loading :show="dataObj">
		<view class="wrap" v-if="dataObj" @click="closeAll">
			<view class="header flex">
				<view class="width-40">
					<i-icon icon="icondindanwancheng" v-if="dataObj.status === 60" class="middle mr-10" type="single" size="34rpx"></i-icon>
					<i-icon icon="iconfabu-cha" v-else-if="dataObj.status === 10" class="middle mr-10" type="single" size="34rpx"></i-icon>
					<i-icon icon="icondingdandengdai" v-else class="middle mr-10" type="single" size="34rpx"></i-icon>
					{{ returnStatus(dataObj.status) }}
				</view>
				<view class="width-60 u-text-right" v-if="dataObj.status === 30">{{ dataObj.appointment_time }}</view>
			</view>
			<view class="model mt-40">
				<view class="flex line28 pad-t-b-15">
					<view class="headImg"><image :src="dataObj.headportrait" mode="widthFix"></image></view>
					<view class="ml-10">{{ dataObj.account_name }}</view>
				</view>
				<view class="flex border-bottom-1 pb-20">
					<view class="width-20 flex color-999">
						<view class="carImg mr-10"><image :src="dataObj.brand_img" mode=""></image></view>
						车型:
					</view>
					<view class="width-80 color-333">{{ dataObj.brand_name }} {{ dataObj.car_type_name }} {{ dataObj.configuration_name }}</view>
				</view>
				<view class="flex pad-t-b-15" v-if="dataObj.status !== 5">
					<view class="width-50 u-text-center u-border-right" @click="contactSeller">
						<i-icon icon="iconxiaoxi1" class="middle mr-10" type="multiple" size="34rpx"></i-icon>
						联系买家
					</view>
					<view class="width-50 u-text-center" @click="phoneClick(dataObj.mobile)">
						<i-icon icon="icondianhua" class="middle mr-10" type="multiple" size="34rpx"></i-icon>
						致电买家
					</view>
				</view>
			</view>
			<!-- 服务类型 -->
			<view class="model">
				<view class="flex pad-t-b-15 border-bottom-1">
					<view class="titleIcon"></view>
					<view class="ml-10 width-80 color-333 font-28 font-bold">服务类型</view>
				</view>
				<view v-for="(it, manind) in dataObj.maintenancetype" :key="manind">
					<view class="flex pad-t-b-20">
						<view class="ml-10 width-80 font-28 color-999">{{ it.maintenance_type_name }}</view>
					</view>
					<view class="pad-t-b-10 border-bottom-1" v-for="(detail, ind1) in it.goodsDetailslist" :key="ind1">
						<view class="flex">
							<view class="listImg" v-if="detail.goods_pic"><image :src="detail.goods_pic" mode=""></image></view>
							<view class="width-60 ml-10 color-333">
								<view class="">{{ detail.goods_name }}</view>
								<!-- 	<view class="flex font-26">
								<view class="label colfbb">全合成</view>
								<view class="label col60C534">4L</view>
							</view> -->
							</view>
							<view :class="[detail.goods_pic ? 'width-20' : 'width-40', 'flex-ai-fe u-text-right']">
								<text class="color-333 font-32 font-bold">￥{{ detail.goods_price }}</text>
								<text class="font-24 color-999 ml-20">x{{ detail.count }}</text>
							</view>
						</view>
					</view>
				</view>

				<view class="flex pad-t-b-20" v-if="dataObj.servicelist.length > 0">
					<view class="titleIcon"></view>
					<view class="ml-10 width-80 font-28 color-999">包含服务</view>
				</view>
				<view class="server" v-if="dataObj.servicelist.length > 0">
					<view class="flex border-bottom-1 pad-t-b-20" v-for="(it, ind) in dataObj.servicelist" :key="ind">
						<i-icon icon="iconshigongweixiu" class="middle mr-10" type="single" size="34rpx" color="#FBB000"></i-icon>
						<view class="width-70">{{ it.service_name }}</view>
						<view class="width-20 u-text-right">
							<text class="font-bold font-32">￥{{ it.service_price }}</text>
							<text class="font-26 color-999 ml-20">x{{ it.service_count }}</text>
						</view>
					</view>
				</view>
				<view class="flex border-bottom-1 pad-t-b-20">
					<i-icon icon="iconyunfei" class="middle" type="single" size="50rpx" color="#FBB000"></i-icon>
					<view class="width-70 ">
						<text class="font-26 color-333  ml-20">运费</text>
						<!-- <text class="font-26 color-666 ml-20">{{ dataObj.coupon_name }}</text> -->
					</view>
					<view class="width-20 u-text-right">
						<text class="font-32 font-bold">￥{{ dataObj.freight }}</text>
					</view>
				</view>
				<view class="flex border-bottom-1 pad-t-b-20" v-if="dataObj.coupon_name">
					<i-icon icon="iconshigongweixiu" class="middle mr-10" type="single" size="34rpx" color="#FBB000"></i-icon>
					<view class="width-70 ">
						<text class="font-28 color-333 font-bold ml-20">优惠券</text>
						<text class="font-26 color-666 ml-20">{{ dataObj.coupon_name }}</text>
					</view>
					<view class="width-20 u-text-right">
						<text class="font-26 color-EB5C02">{{ dataObj.discounts }}</text>
					</view>
				</view>
				<view class="flex pad-t-b-20 flex-jc-fe">
					<view class=" u-text-right font-26" style="padding: 8rpx 0px;">
						已优惠:
						<text class="color-EB5C02">{{ dataObj.discounts }}</text>
					</view>
					<view class=" u-text-right ml-20">
						合计:
						<text class="font-34 color-EB5C02">￥{{ dataObj.amount_payable }}</text>
					</view>
				</view>
			</view>
			<!-- 备注信息 -->
			<view class="model" v-if="dataObj.remark">
				<view class="flex flex-ac-sb pad-t-b-15 border-bottom-1">
					<view class="titleIcon"></view>
					<view class="ml-10 width-80 color-333 font-28 font-bold">备注信息</view>
				</view>
				<view class="pad-t-b-15">{{ dataObj.remark }}</view>
			</view>
			<!-- 订单信息 -->
			<view class="model">
				<view class="flex flex-ac-sb pad-t-b-15 border-bottom-1"><view class="ml-10 width-80 color-333 font-28 font-bold">订单信息</view></view>
				<view class="flex pad-t-b-5">
					<view class="width-25">订单号：</view>
					<view class="width-75 flex">
						<view class="">{{ returntrim(dataObj.order_no) }}</view>
						<!-- #ifdef APP-PLUS -->
						<view class="copy" @click="copy(dataObj.order_no)">复制</view>
						<!-- #endif -->
					</view>
				</view>
				<view class="flex pad-t-b-5">
					<view class="width-25">下单时间：</view>
					<view class="width-75">{{ dataObj.addtime }}</view>
				</view>
				<template v-if="(dataObj.status === 20 || dataObj.status === 30 || dataObj.status === 40 || dataObj.status === 50) && dataObj.pay_time">
					<view class="flex pad-t-b-5">
						<view class="width-25">支付方式：</view>
						<view class="width-75">{{ returnPayTyper(dataObj.pay_type) }}支付</view>
					</view>
					<view class="flex pad-t-b-5">
						<view class="width-25">支付时间：</view>
						<view class="width-75">{{ dataObj.pay_time }}</view>
					</view>
				</template>
				<view class="flex pad-t-b-5" v-if="(dataObj.status === 30 || dataObj.status === 40 || dataObj.status === 60 || dataObj.status === 50) && dataObj.appointment_time">
					<view class="width-25">预约时间：</view>
					<view class="width-75">{{ dataObj.appointment_time }}</view>
				</view>
				<template v-if="dataObj.status === 30 || dataObj.status === 40 || dataObj.status === 50 || dataObj.status === 60">
					<view class="flex pad-t-b-5" v-if="dataObj.stock_up_time">
						<view class="width-25">备货信息：</view>
						<view class="width-75">已备货</view>
					</view>
					<!-- 		<view class="flex pad-t-b-5">
					<view class="width-25">备货时间：</view>
					<view class="width-75">{{ returnTime(dataObj.stock_up_time) }}</view>
				</view> -->
				</template>
				<view class="flex pad-t-b-5" v-if="dataObj.status === 60 && dataObj.accomplish_time">
					<view class="width-25">完成时间：</view>
					<view class="width-75">{{ dataObj.accomplish_time }}</view>
				</view>
			</view>
			<!-- 待付款 -->
			<view class="fixedBottomBtn" v-if="dataObj.status === 5">
				<view class="btn bottomBtn1">
					<view class="btnWrap flex">
						<view class="left width-50" @click="contactSeller">
							<i-icon icon="iconxiaoxi" type="single" class="mr-5 middle" size="36rpx" color="#FFE03B"></i-icon>
							联系客户
						</view>
						<view class="right width-50" @click="phoneClick(dataObj.mobile)">
							<i-icon icon="iconlianxi" type="single" class="mr-5 middle" size="36rpx" color="#333"></i-icon>
							致电客户
						</view>
					</view>
				</view>
			</view>
			<!-- 待备货 -->
			<view class="fixedBottomBtn" v-if="dataObj.status === 20"><view class="btn-bg-yellow bottomBtn" @click.stop="Pregoods = !Pregoods">备货入库</view></view>
			<!-- 待到店 -->
			<view class="fixedBottomBtn" v-if="dataObj.status === 30">
				<view class="btn-bg-yellow bottomBtn" @click.stop="scan">
					<i-icon icon="iconshouye-saoma" type="single" class="mr-5 middle" size="36rpx" color="#333"></i-icon>
					核销验码
				</view>
			</view>
			<!-- 待施工 -->
			<view class="fixedBottomBtn flex" v-if="dataObj.status === 40">
				<view class="bottomBtn2 line30" @click.stop="more = !more">更多</view>
				<!-- <view class="btn-bg-yellow bottomBtn2 bgfff">核销验码</view> -->
				<view class="btn-bg-yellow bottomBtn2" @click.stop="sendWork = true">派工</view>
			</view>
			<!-- 更多列表 -->
			<view class="shadowWrap" v-if="more">
				<view class="shadow">
					<view class="list" @click.stop="sendWork = true">派工</view>
					<!-- <view class="list">核销验码</view> -->
					<view class="list">完工未取车</view>
					<view class="list">完工已取车</view>
				</view>
				<view class="san"></view>
			</view>

			<!-- 备货弹框 -->
			<u-popup v-model="Pregoods" class="bhBox" mode="bottom" border-radius="14">
				<view class="popuptitle">备货信息</view>
				<view class="popupli flex" v-for="(item, index) in prepareGoods" :key="index">
					<view class="width-17">
						<view class="icon" v-if="!item.stock_up_img" @click="selectImg(index)">
							<i-icon icon="iconxiangji" type="single" class="mr-5 middle" size="40rpx" color="#999"></i-icon>
						</view>
						<view class="icon" v-else><image :src="item.stock_up_img" mode="" @click="selectImg(index)"></image></view>
					</view>
					<view class="flex width-83 mt-5 border-bottom-1">
						<view class="width-70">
							<view class="">{{ item.goods_Name }}</view>
							<view class="flex pad-t-b-20" v-if="item.sale_Price>0">
								<i-icon icon="iconqiyebianji" v-show="!item.in_Price" type="single" class="mr-10" size="28rpx" color="#FBB000"></i-icon>
								<text v-show="item.in_Price">￥</text>
								<input type="number" v-model="item.in_Price" :disabled="item.isWrite" class="font-28" placeholder="请输入进货价" placeholder-class="color-FBB000 font-26" />
							</view>
							<view class="flex pad-t-b-20" v-else>
								<text class="color-999">（无需备货）</text>
							</view>
						</view>
						<!-- <view class="width-10 u-text-center  color-333">4L</view> -->
						<view class="width-30">
							<view class="u-text-right">￥{{ item.sale_Price>0?item.sale_Price:item.service_price }}</view>
							<view class="pad-t-b-20 u-text-right">x{{ item.count }}</view>
						</view>
					</view>
				</view>
				<view class="bottomBtn">
					<view class="btnWrap flex">
						<view class="left width-50" @click.stop="Pregoods = !Pregoods">取消</view>
						<view class="right width-50" @click.stop="PreGoods">保存</view>
					</view>
				</view>
			</u-popup>
			<!-- 弹框提示 -->
			<u-popup v-model="tipShow" mode="center" width="540">
				<view class="popup-content">
					<view class="title">温馨提示</view>
					<view class="content">您的门店无该车辆到店记录和订单， 请通过手机号码创建到店记录</view>
					<view class="btn-box"><button class="btn" @click="okey()">我知道了</button></view>
				</view>
			</u-popup>
			<technicianSelector :showoppen="sendWork" @selTechnician="selTechnician"></technicianSelector>
		</view>
	</page-loading>
</template>

<script src="./orderDetail.js"></script>

<style lang="scss" scoped>
@import './orderDetail.scss';
</style>
